<?php
    class Main_Model extends CI_Model
    {
        var $table = "db_countries";
        public function __construct()
        {
            parent::__construct();
        }
        public function list_country()
        {
            return $this->db->get($this->table)->result();
        }
        public function get_name_country($id)
        {
            $q = $this->db->get_where($this->table,array('id_country'=>$id));
            if($q->num_rows() > 0)
            {
                return $q->row()->name_country;
            }
            else
            {
                return false;
            }
        }
        public function get_name_level($id)
        {
            $q = $this->db->get_where("db_level",array('id_level'=>$id));
            if($q->num_rows() > 0)
            {
                return $q->row()->name_level;
            }
            else
            {
                return false;
            }
        }
    }
?>